package health.lm.com.shop.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

import health.lm.com.shop.entity.CompanyDynamicEntity;
import health.lm.com.shop.fragment.PeopleChainPageFragment;


/**
 * @author GQI
 * description 人脉适配器
 */
public class PeopleChainPageAdapter extends FragmentStatePagerAdapter {
    private List<CompanyDynamicEntity> entities;

    public PeopleChainPageAdapter(FragmentManager fm, List<CompanyDynamicEntity> entities) {
        super(fm);
        this.entities = entities;
    }


    @Override
    public Fragment getItem(int i) {
        return PeopleChainPageFragment.getInstance(entities.get(i).getId());
    }

    @Override
    public int getCount() {
        return entities.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return entities.get(position).getTitle();
    }
}
